App.controller('publishAuditController', ['$rootScope', '$scope', '$state', 'Page', function ($rootScope, $scope, $state, Page) {
	
    Page.ajaxPostQuiet('customer/queryCustomer.do', null, function (resp) {
        $scope.customerList = resp.data;
    });
	
	$scope.publishBillAuditTasksGrid = {
		column_defs: [
			{
	         	target: 2,
	         	template: function(row) {
					var customerName = row.bill.customerId;
					$($scope.customerList).each(function(index, customer) {
						if(row.bill.customerId == customer.customerId){
							customerName = customer.customerName;
						}
					});
                    return customerName;
                }
            },
			{
	            target: 5,
	            buttons: [
	            	{
	                    name: '办理',
	                    clazz: 'btn-edit',
	                    icon: 'fa-edit',
	                    event: function(row){
	            		 	$state.go('auth.taskComplete', {task: row, taskId: row.id});
	                    }
	               	}
	            ]
            }
		]
	};

}]);
